﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.db2
{
	// Token: 0x020001DC RID: 476
	public class TDb2IfStmt : TCustomDb2Stmt
	{
		// Token: 0x06001008 RID: 4104 RVA: 0x0030C77F File Offset: 0x0030A97F
		public TDb2IfStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstdb2ifstmt;
		}

		// Token: 0x06001009 RID: 4105 RVA: 0x0030C793 File Offset: 0x0030A993
		internal override void buildsql()
		{
		}

		// Token: 0x0600100A RID: 4106 RVA: 0x0030C795 File Offset: 0x0030A995
		internal override void clear()
		{
		}

		// Token: 0x0600100B RID: 4107 RVA: 0x0030C797 File Offset: 0x0030A997
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x0600100C RID: 4108 RVA: 0x0030C79E File Offset: 0x0030A99E
		internal override void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x0600100D RID: 4109 RVA: 0x0030C7A0 File Offset: 0x0030A9A0
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TIfSqlNode tifSqlNode = (TIfSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.condition = tifSqlNode.Condition;
			this.condition.doParse(this, ESqlClause.unknown);
			if (tifSqlNode.ThenStmts != null)
			{
				tifSqlNode.ThenStmts.doParse(this, ESqlClause.unknown);
				for (int i = 0; i < tifSqlNode.ThenStmts.size(); i++)
				{
					this.ThenStmts.add(tifSqlNode.ThenStmts.getStatementSqlNode(i).Stmt);
				}
			}
			if (tifSqlNode.ElseIfList != null)
			{
				tifSqlNode.ElseIfList.doParse(this, ESqlClause.unknown);
				this.elseIfList = tifSqlNode.ElseIfList;
			}
			if (tifSqlNode.ElseStmts != null)
			{
				tifSqlNode.ElseStmts.doParse(this, ESqlClause.unknown);
				for (int j = 0; j < tifSqlNode.ElseStmts.size(); j++)
				{
					this.ElseStmts.add(tifSqlNode.ElseStmts.getStatementSqlNode(j).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x170002FB RID: 763
		// (get) Token: 0x0600100E RID: 4110 RVA: 0x0030C894 File Offset: 0x0030AA94
		// (set) Token: 0x0600100F RID: 4111 RVA: 0x0030C89C File Offset: 0x0030AA9C
		public virtual TExpression Condition
		{
			get
			{
				return this.condition;
			}
			set
			{
				this.condition = value;
			}
		}

		// Token: 0x170002FC RID: 764
		// (get) Token: 0x06001010 RID: 4112 RVA: 0x0030C8A5 File Offset: 0x0030AAA5
		// (set) Token: 0x06001011 RID: 4113 RVA: 0x0030C8C0 File Offset: 0x0030AAC0
		public virtual TStatementList ElseStmts
		{
			get
			{
				if (this.elseStmts == null)
				{
					this.elseStmts = new TStatementList();
				}
				return this.elseStmts;
			}
			set
			{
				this.elseStmts = value;
			}
		}

		// Token: 0x170002FD RID: 765
		// (get) Token: 0x06001012 RID: 4114 RVA: 0x0030C8C9 File Offset: 0x0030AAC9
		// (set) Token: 0x06001013 RID: 4115 RVA: 0x0030C8E4 File Offset: 0x0030AAE4
		public virtual TStatementList ThenStmts
		{
			get
			{
				if (this.thenStmts == null)
				{
					this.thenStmts = new TStatementList();
				}
				return this.thenStmts;
			}
			set
			{
				this.thenStmts = value;
			}
		}

		// Token: 0x170002FE RID: 766
		// (get) Token: 0x06001014 RID: 4116 RVA: 0x0030C8ED File Offset: 0x0030AAED
		public virtual TElseIfSqlNodeList ElseIfList
		{
			get
			{
				return this.elseIfList;
			}
		}

		// Token: 0x06001015 RID: 4117 RVA: 0x0030C8F8 File Offset: 0x0030AAF8
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.condition.accept(v);
			if (this.thenStmts != null)
			{
				this.thenStmts.accept(v);
			}
			if (this.elseIfList != null)
			{
				this.elseIfList.accept(v);
			}
			if (this.elseStmts != null)
			{
				this.elseStmts.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x0400138A RID: 5002
		private TExpression condition;

		// Token: 0x0400138B RID: 5003
		private TStatementList thenStmts;

		// Token: 0x0400138C RID: 5004
		private TStatementList elseStmts;

		// Token: 0x0400138D RID: 5005
		private TElseIfSqlNodeList elseIfList;
	}
}
